One or more aspects relate, in general, to processing within a computing environment, and in particular, to improving such processing.
Applications executing within a processor of a computing environment control the behavior of the processor. The applications are created using programming languages which are designed to communicate instructions to the processor. There are various types of programming languages, and each language may use one or more types of encodings to represent data.
For example, binary coded decimal (BCD) is a native data type encoding in the programming languages COBOL and PL/I, and is also a supported data type in the DB2 database management system. Through language and class library extensions, other languages, such as C and Java, also support some forms of BCD data types.
One computational BCD type, packed decimal, has an encoding that specifies one decimal digit encoded in every 4 bits of storage except for the least significant 4 bits of the least significant byte where a 4 digit sign code is encoded. The sign code can be any non-numeric 4 bit value covering the hexadecimal values 0xA through 0xF. For example, the value +123 can be encoded in two bytes of storage as hexadecimal 12 3C.
A display BCD type, zoned decimal, shares this type of sign encoding as well. The value +123 in zoned decimal is encoded in three bytes of storage as hexadecimal F1 F2 C3. The sign code overlays the most significant 4 bits of the least significant byte.
The mapping of sign codes to a sign value is as follows:
0xA: +
0xB: −
0xC: + (selected plus encoding)
0xD: − (selected minus encoding)
0xE: +
0xF: + (selected unsigned encoding)
As noted above, certain sign codes are designated as the canonical or selected encodings. This means that although any of these signs are accepted on input, the compiler produced code is to produce the selected encodings on output (according to how the data type was declared − signed variables use 0xC or 0xD, and unsigned variables use 0xF).
Unsigned variables are not “signless”, but instead they can have any (even a minus encoding) on input, but to adhere to language rules, the compiler produced code is to generate an 0xF sign code on output for an expression (including simple moves and before compares, in addition to arithmetic expressions).
To perform a sign operation for an output datum, multiple instructions are used.